#include "gofgame/dungeonkeeper/game/unit/SpearMan.h"

using namespace gofgame::dungeonkeeper::game::unit;

SpearMan::SpearMan(){
	id = 202;
}

SpearMan::~SpearMan(){
}

bool SpearMan::init(){
	bool pRet = false;
	do 
	{
		unitType = UnitType::createById(this->id);
		texture = CCSprite::create(unitType.imageName);
		this->addChild(texture);
		updateState();
		Unit::init();
		pRet = true;
	} while (0);
	return pRet;
}

SpearMan * SpearMan::createByLevel(int lv){
	SpearMan *spearMan = new SpearMan();
	if(spearMan){
		spearMan->lv = lv;
		if( spearMan->init()){
			return spearMan;
		} else {
			return nullptr;
		}
	} else{
		return nullptr;
	}
}

void SpearMan::initData(){
	unitType.updateLv(lv);
	this->origHp = unitType.getBaseHP();
	this->currentHp = origHp;
	this->atk =  unitType.getBaseAtk();
	this->def =  unitType.getBaseDef();
	this->speed = unitType.getBaseSpeed();
	this->attkSpeed = unitType.getBaseAttackSpeed();
	this->range = unitType.getBaseRange();
}


void SpearMan::doAI(){

}

